import { CoolController, BaseController } from "@cool-midway/core";
import { CityInfoEntity } from "../../entity/info";
import { CityInfoService } from "../../service/info";
import { Body, Inject, Post } from "@midwayjs/core";

@CoolController({
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: CityInfoEntity,
    service: CityInfoService,
})
export class AdminCityInfoController extends BaseController {

    @Inject()
    cityInfoService: CityInfoService;

    @Post('/cover', { summary: '设置城市封面' })
    async cover(@Body('id') id: number, @Body('cover') cover: string) {
        return this.ok(await this.cityInfoService.setCover(id, cover));
    }

}